package com.aop.test;

import com.aop.bean.Calculate;
import com.aop.bean.Depend;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.SpringVersion;

public class AopMain {
	public static void main(String[] args) {
		testAop();
//		testCircleAop();
	}

	private static void testAop() {
		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AopMainConfig.class);
		Calculate calculate = ctx.getBean(Calculate.class);
		int result = calculate.add(2, 4);
//		int result = calculate.modulus(4, 3);
		System.out.println("运算的结果是: " + result);
		System.out.println(SpringVersion.getVersion());
	}

	private static void testCircleAop() {
		AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(AopMainConfig.class);
		Depend calculate = ctx.getBean(Depend.class);
		int result = calculate.dependAdd(2, 4);
		System.out.println("运算结果是: " + result);
	}
}
